package com.shuoyue.ycgk.ui;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;

import com.shuoyue.ycgk.R;
import com.shuoyue.ycgk.entity.TimerTable;
import com.shuoyue.ycgk.ui.course.info.CourseInfoActivity;
import com.shuoyue.ycgk.ui.course.playvideo.PlayVideoActivity;
import com.shuoyue.ycgk.ui.main.MainTabActivity;
import com.shuoyue.ycgk.ui.mine.learnprogress.DealClassProgressActivity;
import com.shuoyue.ycgk.ui.questionbank.practice.specialtraining.questionitem.SpeciaDoingActivity;
import com.yanzhenjie.permission.AndPermission;
import com.yanzhenjie.permission.runtime.Permission;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        AndPermission.with(this)
                .runtime()
                .permission(Permission.WRITE_EXTERNAL_STORAGE)
                .start();
    }

    public void testView(View view) {

        startActivity(new Intent(this, TestViewActivity.class));
//        PlayerActivity.start(this, "http://vfx.mtime.cn/Video/2019/03/14/mp4/190314223540373995.mp4", "点播", false);
//        startActivity(new Intent(this, PlayerActivity.class));
//        startActivity(new Intent(this, QuestionSpecialActivityWrong.class));

    }

    public void playVideo(View view) {

        startActivity(new Intent(this, PlayVideoActivity.class)
                .putExtra("table", (ArrayList) getTestData()));
//        PlayerActivity.start(this, "http://vfx.mtime.cn/Video/2019/03/14/mp4/190314223540373995.mp4", "点播", false);
//        startActivity(new Intent(this, PlayerActivity.class));
//        startActivity(new Intent(this, QuestionSpecialActivityWrong.class));

    }

    public void doQuestionSpecial(View view) {
        startActivity(new Intent(this, SpeciaDoingActivity.class));
    }

    public void doQuestionExamination(View view) {
//        startActivity(new Intent(this, EstamateQuestionActivity.class));
    }

    public void mainPage(View view) {
        startActivity(new Intent(this, MainTabActivity.class));
    }

    private List<TimerTable> getTestData() {
        List<TimerTable> testData = new ArrayList<>();

        for (int i = 0; i < 5; i++) {
            TimerTable timerTableLv1 = new TimerTable();
            timerTableLv1.setName("xxxxxxxx");
            timerTableLv1.setNodes(new ArrayList<>());
            for (int k = 0; k < 4; k++) {
                TimerTable liveCourse = new TimerTable();
                liveCourse.setName("sdf98uwehosdf");
                timerTableLv1.getNodes().add(liveCourse);
            }
            testData.add(timerTableLv1);
        }

        return testData;
    }

    public void courseInfo(View view) {
        startActivity(new Intent(this, CourseInfoActivity.class));
    }

    public void dealProgress(View view) {
        startActivity(new Intent(this, DealClassProgressActivity.class));


    }
}
